Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

glsl-token-depth

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

glsl-token-depth

Determine the scope depth of an array of GLSL tokens

  • 1.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
177K
decreased by-28.42%
Maintainers
2
Weekly downloads
 
Created
Source

glsl-token-depth

experimental

Determine the scope depth of an array of GLSL tokens.

Useful for inferring the scope of variables in a GLSL shader without having to fully parse the source.

Usage

NPM

depth(tokens)

Where tokens is an array of tokens returned from glsl-tokenizer. Each token will be modified in-place, and given a depth property.

var tokenize = require('glsl-tokenizer/string')
var depth    = require('glsl-token-depth')
var fs       = require('fs')

var src = fs.readFileSync('shader.frag', 'utf8')
var tokens = tokenize(src)

depth(tokens)

tokens[0].depth // 0
tokens[1].depth // 0
tokens[2].depth // 0
tokens[3].depth // 0
tokens[4].depth // 1
// ...

See Also

License

MIT. See LICENSE.md for details.

Keywords

FAQs

Package last updated on 11 Mar 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc